1. Field of the Invention
The present invention is related to a computer system""s basic input output system (BIOS), and more particularly, a mechanism to detect and accommodate an invalid BIOS image that allows the computer system to be fully operational until a valid BIOS image can be obtained.
2. Description of the Related Art
The typical computer system contains embedded low-level BIOS code used to initialize the computer system. The BIOS also includes code that interfaces between the operating system and the specific hardware configuration, allowing the same operating system to be used with different hardware configurations. Flash ROM (Read-Only Memory) previously has been used to store the BIOS. Flash ROM is an inherently non-volatile memory that allows for in-system updateability. Updating occurs by xe2x80x9cflashingxe2x80x9d or writing a new ROM image onto the chip while the system is operational, from a variety of possible sources, including removable media devices, modem links, or parallel or serial connectors.
Typical BIOS functions include the initialization of disk drives, including floppy, hard, and CD-ROM, and initialization of the video and graphical interfaces. The BIOS is specifically configured for each computer system based on the presence of specific hardware and the current hardware version or manufacturer. If the computer system hardware is updated or modified, the BIOS may need to be updated or upgraded to properly initialize the new hardware. The user can flash the updated or upgraded BIOS to the Flash ROM after the user has replaced or upgraded a component of the computer system.
A potential problem exists, however, when an updated BIOS is flashed. An incorrect BIOS could be flashed inadvertently or the flash interrupted, resulting in corrupted data in the Flash ROM. A computer virus possibly could infect an updated or upgraded BIOS as well. Corrupted data in the Flash ROM would not allow the system to initialize properly. To prevent this, the Flash ROM memory array previously has been divided into two distinct sections, a boot block and a main block. The boot block is a small BIOS residing in an unprogrammable (i.e., a hardware blocked) sector (also referred to as segment) in the Flash ROM part and contains only enough functionality to allow the main ROM to be reprogrammed from, for example, a floppy disk image. Although the boot block typically contains minimal initialization routines for a floppy disk drive and a keyboard, it does not contain routines for a video interface because of the size of such code and its non-standard nature. The boot block of the Flash ROM is protected from an ordinary flash, and the data stored in the boot block will remain even after a corrupted ROM image is flashed. The previously discussed initialization routines all reside in the main block of the Flash ROM.
The boot block can be used to store the kernel code necessary to initialize the basic components of the system even if a corrupted ROM image is present. The boot block may be code merely sufficient to allow the corrupted ROM to be reflashed. Typically, the standard ROM voltage levels, such as 3-5 volts, necessary to perform an in-system ROM flash cannot alter the boot block code. Instead, higher voltage levels, such as 12 volts, or moving a jumper in circuitry associated with the Flash ROM, usually are required, as will be appreciated by those skilled in the art. Therefore, even if the Flash ROM is incorrectly flashed or the flashed main ROM is corrupted, because of the code present in the boot block, the system still will initialize enough to allow the user to flash the correct main ROM image to the Flash ROM, using a variety of techniques.
The boot block configuration outlined above allows recovery after a power loss during flashing, or loading of an invalid or corrupted BIOS image. The boot block requires the development of unique BIOS code for the purpose of allowing the main ROM to be reflashed via removable media (or medium), such as a floppy disk. Generally, a computer system that is booting from the boot block loads the operating system from the removable media. The computer system, however, does not have to be in boot block recovery to boot from removable media. A computer system can be configured to boot from removable media when the removable media is present, regardless of whether the computer system is in boot block recovery.
While much of the code for boot block support may be simply copied from the main BIOS code, considerable new hardware dependent code must be developed for each new product. Additionally, the boot block BIOS depends on the availability of a BIOS flash removable media; if the removable medium is not available, the computer is not sufficiently functional to obtain the BIOS image by other means, such as downloading via modem.
Further, because a computer""s system BIOS can be flashed or reflashed outside the factory, there is a need for a more robust recovery mechanism when the flash part is corrupted due to flashing an invalid BIOS, or when the flash process is interrupted before it completes, whether or not removable media are present. Every time a computer""s system BIOS is flashed, the computer system can be rendered irrecoverably unbootable, either due to power loss during the flashing process, or loading an invalid or corrupted BIOS image.
According to embodiments of the invention, a computer system features support of a permanent (backup) and a main BIOS in a non-volatile memory, such as a flashable ROM. The computer system is fully initialized and made fully operational using either the backup BIOS or the main BIOS. Which BIOS is used depends on the validity of the main BIOS, or whether booting is successful using the main BIOS. During power-up, the computer system determines if a non-volatile memory is invalid or corrupt, or if a predetermined number of reboot tries has occurred in attempting to use the main BIOS. A count is made of the number of times booting is retried with the main BIOS. If a predetermined count value is reached, or if the main BIOS is invalid, then only the backup BIOS is used to complete booting. If, however, the predetermined count value is not reached, booting continues using the main BIOS.
The non-volatile memory includes a permanent protected portion and a writeable or flashable portion. The backup BIOS is stored in the permanent protected portion of the nonvolatile memory and the main BIOS is stored in the writeable portion of the non-volatile memory. The permanent protected portion is protected by the design of the backup BIOS code itself, independent of any hardware protection, such as blockable sectors. The backup BIOS code is written so as not to allow overwriting, flashing, or otherwise altering the permanent protected portion. However, hardware protection is not precluded in some embodiments of the present invention and can be used in addition to the software-based protection.
The number of contiguous or non-contiguous blocks of the non-volatile memory used to store the backup BIOS and the main BIOS depends on the specific architecture of the non-volatile memory. In one embodiment, the backup BIOS and the main BIOS are stored each in single contiguous blocks of the non-volatile memory. In other embodiments, the backup BIOS and the main BIOS are stored each in a plurality of individually contiguous or non-contiguous blocks of the non-volatile memory.
In one aspect, embodiments of the invention feature validating the main BIOS using the backup BIOS. If the main BIOS is invalid or unavailable, then only the backup BIOS is executed until the computer system is fully operational. On the other hand, if the main BIOS is valid, then the main BIOS is executed until the computer system is fully operational.